﻿$(document).ready(function () {
    var form = $("#frmLogin:first");
    $("#btnEntrar").click(function (e) {
        e.preventDefault();
        var lblMessage = $("#lblMessage:first").text("");
        var cpf = $("#txtLogin:first", form);
        var password = $("#txtPassword:first", form);
        $(".required", form).each(function () {
            $(this).removeClass("ui-state-error");
            if ($(this).val() == "") {
                lblMessage.text("Preencha os campos em destaque.");
                $(this).addClass("ui-state-error");
            }
        });
        if (lblMessage.text() == "")
            form.submit();
    });

    $("#txtPassword:first", form).keyup(function (e) { if (e.which == 13) { $("#btnEntrar").click(); } });
    $("#txtPassword:first", form).val("");
    $("#txtLogin:first", form).focus();
});